﻿@using AntDesign
@using ZLJ.Admin.CoreRCL.Share
<!DOCTYPE html>
<html lang="zh-cn">

<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <base href="/" />
    <link antblazor-css>

    @* 下面这个引用不了，也没必要 *@
    @* <link href="_content/ZLJ.Admin.CoreRCL/css/site.css" rel="stylesheet"> *@


    <HeadOutlet @rendermode="RenderModeForPage" />
</head>

<body style="background: #ddd url('/light-poly.png') repeat;">

    @if (this.RenderModeForPage != null)
    {
        <div id="loadingDiv" style="display:none; position:absolute;z-index:9999; width:100%; height:100%; text-align:center; padding-top:30vh ">
            <Spin Tip="加载中，请稍后..." Size="large" />
        </div>
    }
    <script>
        try { document.getElementById('loadingDiv').style.display = 'block'; } catch { }
        function hideLoadingDiv() {
            //removeClass(document.getElementById('loadingDiv'), 'show-loading');
            try {
                document.getElementById('loadingDiv').style.display = 'none';
            } catch { }
        }

    </script>




    <app>
        <Routes @rendermode="RenderModeForPage" />
    </app>
    @* 图表库，cdn经常访问不了 *@
    @* <script type="text/javascript" src="@("https://unpkg.com/@antv/g2plot@2.4.17/dist/g2plot.min.js")"></script> *@
    @* <script type="text/javascript" src="g2plot.min.js"></script> *@
    @* 新版本已经内嵌了 *@
    @* <script src="_content/AntDesign/js/ant-design-blazor.js"></script> *@
    @* <script src="_content/AntDesign.Charts/ant-design-charts-blazor.js"></script> *@
    <script antblazor-js></script>
    <script src="_framework/blazor.web.js" autostart="false"></script>
    @* <script src="https://cdn.bootcdn.net/ajax/libs/echarts/5.4.3/echarts.min.js"></script> *@
    <script type="module">
        import { BrotliDecode } from '/decode.min.js';
        Blazor.start({
            webAssembly: {
                loadBootResource: function (type, name, defaultUri, integrity) {
                    if (type !== 'dotnetjs' && location.hostname !== 'localhost' && type !== 'configuration' && type !== 'manifest') {
                        return (async function () {
                            const response = await fetch(defaultUri + '.br', { cache: 'no-cache' });
                            if (!response.ok) {
                                throw new Error(response.statusText);
                            }
                            const originalResponseBuffer = await response.arrayBuffer();
                            const originalResponseArray = new Int8Array(originalResponseBuffer);
                            const decompressedResponseArray = BrotliDecode(originalResponseArray);
                            const contentType = type ===
                                'dotnetwasm' ? 'application/wasm' : 'application/octet-stream';
                            return new Response(decompressedResponseArray,
                                { headers: { 'content-type': contentType } });
                        })();
                    }
                }
            }
        });
        //https://github.com/dotnet/aspnetcore/pull/53291
        //注意上面的blazor.web.js autostart="false"
        //经过测试，下面的测试没什么卵用
        // Blazor.start({
        //     webAssembly: {
        //         configureRuntime: (builder) => {
        //             builder.withConfig({
        //                 maxParallelDownloads: 1
        //             });
        //         },
        //     },
        // });
    </script>

</body>
</html>